<?php 
// no direct access
defined('_JEXEC') or die('Restricted access');

//$template_dir = $this->baseurl.'/templates/mwc_careitec/assets/';
$template_dir = '/templates/mwc_careitec/assets/';
jimport('mylibs.globalModel');
$globalModel = new globalModel();
       
$menu_id = JRequest::getVar('Itemid', 0, 'get');
$cat_id = JRequest::getVar('category_id', 0, 'get');
$layout = JRequest::getVar('layout', 0, 'get');
$emulate = JRequest::getVar('emulate', 0, 'get'); 
$current_id = JRequest::getVar('id', 0, 'get');  
$success = JRequest::getVar('success', 0, 'get');

$menus = &JSite::getMenu();                                             
$menu  = $menus->getActive();    
$ignore = $menu->query['id']; 
?>

<div id="main" class="p15t">
    <div class="w214 float_left">
        <!-- Menu -->
        <div class="w214 left_menu m10b">
            <div class="left_menu">
                <ul class="parent_menu">    
                    <li class="curr_left_menu">
                        <a href="javascript:void(0);"><?php echo $menu->name; ?></a> 
                        <ul class="child_menu">                                
                            <?php 
                            $layout = $layout ? '&layout=' . $layout : '';                            
                            $sub_menu = $globalModel->getChildrenMenu($menu_id, 0); 
                            foreach($sub_menu as $value ){ 
                                //$selected = $current_id == $value['id'] ? ' class="active"'   : '';                                
                                $current  = $current_id == $value['id'] ? ' class="curr_sub"' : '';
                                $link = $value['link']. '&Itemid=' . $menu_id . '&id=' . $value['id'];
                                ?>    
                                <li<?php //echo $selected; ?>>
                                    <a <?php echo $current; ?> href="<?php echo $link; ?>" ><?php echo $value['name'];?></a>
                                </li>                  
                            <?php } ?> 
                        </ul>
                    </li> 
                </ul>
            </div>
            <div class="left_menu_bot"></div>
        </div>
        
        <!-- Book -->
        <div class="w214 po m10b"> 
            <?php 
            $link = 'index.php?option=com_user&view=book';                           
            ?>  
            
            <a href="<?php echo $link; ?>"><img src="<?php echo $template_dir; ?>images/book_banner.png" alt="" /></a>                        
        </div>
        
        <!-- Banner 1 -->         
        <div class="w214 m10b">
            <a href="#"><img src="<?php echo $template_dir; ?>images/banner_ads_girl.jpg" alt="" /></a>
        </div>
        
        <!-- News -->
        <div class="w214">
            <div class="ads_sub_top"></div>
            <div class="ads_sub_mid">
                <div class="w186 mc p10t p10b">
                    <?php                 
                    // Intel Inside   
                    $arr_data2 = $globalModel->getArticle(57);
                    foreach($arr_data2 as $key => $value){    
                        $text = strip_tags($value['introtext']);
                        $text = strlen($text) > 100 ? mb_substr($text, 0, 100, 'UTF-8') : $text;
                        $link = '#';
                        ?> 
                        <?php if(1==0){ ?>
                        <a href="<?php echo $link; ?>"><img src="<?php echo $template_dir; ?>images/banner_ads_sub.jpg" alt="<?php echo $value['title'];?>" /></a>
                        <?php } ?>
                        <a href="<?php echo $link; ?>"><img src="<?php echo $value['article_image']; ?>" alt="<?php echo $value['title'];?>" /></a>                 
                        <p class="p5t"><?php echo $text; ?>...<a href="<?php echo $link; ?>"><?php echo JText::_('READ_MORE'); ?></a></p>                            
                    <?php } ?> 
                </div>
            </div>
            <div class="ads_sub_bot"></div>
        </div>
    </div>
    
    <div class="w708 bg_left_col2 float_right p22l">
        <div class="w708 bg_tt_sub1">
            <h2 class="p5t float_left">Bestyrelsen</h2>
            <p class="float_right p5t" style="display:none"><a href="#"><img src="images/tilbage_icon.png" alt="" /> Tilbage</a></p>
            <br style="clear:both" />
        </div>
        <div class="w708">
            <?php
            $max_item = $this->limit;  
            for ($i = 0; $i < $max_item; $i++){  
                if($i + $this->limitstart >= $this->total){
                    break;
                }         
                       
                $item = $this->items[$i];                  
                $description = strlen($item->description) <= 380 ? $item->description : mb_substr($item->description, 0, 380, 'UTF-8')
            ?>
                <div class="w708 m15b">
                    <div class="img_admin_bg float_left">
                        <img src="<?php echo $item->image; ?>" alt="" width="103" height="116" />
                    </div>
                    <div class="w570 float_right">
                        <p>
                            <b><?php echo $item->title; ?></b><br/>
                            <?php echo $item->name; ?><br/>
                            <?php echo $item->position; ?>
                        </p>
                        <br/>
                        <p><?php echo $description; ?></p>
                    </div>                   
                    <div class="cb"></div>   
                </div>
            <?php }?>      
            
            <div class="pt w708">
                <ul>
                    <?php 
                    if ($this->pagination->get('pages.total') > 1){ 
                        echo $this->pagination->getPagesLinks();       
                    }
                    ?>  
                </ul>
                <br class="cb" />
            </div>   
        </div>       
    </div>
    <div class="cb"></div>
</div>

<div id="footer" class="bg_foot_sub">
    <div class="w950 mc p15t p15b">
        <p class="float_left">Copyright © 2010 <a href="index.html">CAREITEC.DK</a>. All rights reserved.</p>
        <p class="float_right">Design by <a href="http://mywebcreations.dk" target="_blank">My Web Creations</a></p>
        <br style="clear:both" />
    </div>
</div>